<?php
/**
 * 验证器
 * 菜单
 * */
namespace app\admin\validate;
use think\Validate;

class User extends Validate{
    protected $rule =   [
        'name' => 'require|min:3',
        'password'=>'require|confirm',
        'email' =>'require|email',

    ];

    protected $message  =   [

        'name.require' => '用户名不能为空',
        'name.min' =>'最小长度为3',

        'password.require' => '密码不能为空',
        'password.confirm' => '密码输入不一致',


        'email.require' => '邮箱不能为空',
        'email.email' => '邮箱格式错误',

    ];

    // 指定验证某些字段 （一般情况下用不到）
    protected $scene = [
        'login' =>  ['name'],
        'add' =>  ['name','password','email'],
        'edit' =>  ['password','email'],

        // 不需要验证码密码
        'edit_no_pw'  =>  ['email']
    ];

}